home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2008 September
/
PCWorld_2008-09_cd.bin
/
v cisle
/
sadanastroju
/
wot-20080519-fx.xpi
/
chrome
/
wot.jar
/
content
/
cookies.js
< prev
next >
Wrap
Text File
|
2007-11-11
|
2KB
|
69 lines
/*
cookies.js
Copyright © 2006, 2007 Against Intuition, Inc. <info@mywot.com>
*/
const WOT_COOKIE_TIMEOUT = 10000;
const WOT_COOKIE_TOPIC = "http-on-modify-request";
function wot_cookie_remover(request)
{
this.channel = request.channel;
this.service = Components.classes["@mozilla.org/observer-service;1"].
getService(Components.interfaces.nsIObserverService);
this.service.addObserver(this, WOT_COOKIE_TOPIC, false);
this.timeout = window.setTimeout(this.stop, WOT_COOKIE_TIMEOUT);
}
wot_cookie_remover.prototype =
{
channel: null,
service: null,
timeout: null,
QueryInterface: function(iid)
{
if (!iid.equals(Components.interfaces.nsISupports) &&
!iid.equals(Components.interfaces.nsIObserver)) {
throw Components.results.NS_ERROR_NO_INTERFACE;
}
return this;
},
observe: function(subject, topic, data)
{
try {
if (topic == WOT_COOKIE_TOPIC && subject == this.channel) {
this.channel.QueryInterface(Components.interfaces.nsIHttpChannel);
this.channel.setRequestHeader("Cookie", "", false);
this.stop();
}
} catch (e) {
dump("wot_cookie_remover.observe: failed with " + e + "\n");
}
},
stop: function()
{
try {
if (this.timeout) {
window.clearTimeout(this.timeout);
this.timeout = null;
}
if (this.service) {
this.service.removeObserver(this, WOT_COOKIE_TOPIC);
this.service = null;
}
this.channel = null;
} catch (e) {
dump("wot_cookie_remover.stop: failed with " + e + "\n");
}
}
};